package com.example.controller.admin;

import com.example.pojo.ArticleInfo;
import com.example.pojo.User;
import com.example.service.UserService;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Description TODO
 * @Author fantasy
 * @Date 2024/7/15 22:47
 **/


@Controller
public class LoginController {

    @Autowired
    private UserService userService;
    @GetMapping("/login")
    public String index() {
        return "login";
    }
    @RequestMapping("/admin/home")
    public String toHome(Model model){
        List<ArticleInfo> dayInfo = userService.getDayInfo();
        model.addAttribute("dayInfo",dayInfo);
        return "home";
    }

}
